import fitz


def extract_pdf_text(pdf_path):
    pages = fitz.open(pdf_path)
    text_list = []
    for page in pages:
        text_list.append(page.get_text("text"))
    all_text = "\n".join(text_list)
    return all_text


if __name__ == "__main__":
    result_text = extract_pdf_text("pdf.pdf")
    print(result_text)
